﻿using DFGK_WMS.IRepository;
using DFGK_WMS.Repository;
using DFGK_WMS.WebAPI.Controllers.Result;
using Microsoft.AspNetCore.Mvc;
using System.Net.WebSockets;

namespace DFGK_WMS.WebAPI.Controllers.可视化大屏_暂定_
{
    [Route("api/[controller]")]
    [ApiController]
    public class VisuallargeScreenController : ControllerBase
    {
        public IVisuallargeScreenRepository VisuallargeScreenRepository1;

        public VisuallargeScreenController(IVisuallargeScreenRepository visuallargeScreenRepository)
        {
            VisuallargeScreenRepository1 = visuallargeScreenRepository;
        }

        /// <summary>
        /// 待办已办任务统计
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [HttpGet("GetToDoDone")] 
        public IActionResult GetToDoDone(int pageIndex, int pageSize, int type)
        {
            int totalCount = 0;
            var list = VisuallargeScreenRepository1.GetToDoDone(pageIndex,pageSize,type,out totalCount);
            if (list != null || list.Count <= 0)
            {
                return Ok(BaseResult.Result(list, "查询成功！", "200"));
            }
            return Ok(BaseResult.Result(false, "查询失败！", "500"));
        }

        /// <summary>
        /// 月出入移盘统计
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [HttpGet("GetAllQty")]
        public IActionResult GetAllQty()
        {
            var list = VisuallargeScreenRepository1.GetAllQty();
            if (list != null)
            {
                return Ok(BaseResult.Result(list, "查询成功！", "200"));
            }
            return Ok(BaseResult.Result(false, "查询失败！", "500"));
        }

        /// <summary>
        /// 获取库存总数
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [HttpGet("GetInventoryQty")]
        public IActionResult GetInventoryQty()
        {
            var list = VisuallargeScreenRepository1.GetInventoryQty();
            if (list != null)
            {
                return Ok(BaseResult.Result(list, "查询成功！", "200"));
            }
            return Ok(BaseResult.Result(false, "查询失败！", "500"));
        }

        /// <summary>
        /// 根据质量等级查询
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [HttpGet("GetQtyByQualityState")]
        public IActionResult GetQtyByQualityState()
        {
            var list = VisuallargeScreenRepository1.GetQtyByQualityState();
            if (list != null)
            {
                return Ok(BaseResult.Result(list, "查询成功！", "200"));
            }
            return Ok(BaseResult.Result(false, "查询失败！", "500"));
        }

        /// <summary>
        /// 出入库数量统计
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [HttpGet("GetQtyByWork")]
        public IActionResult GetQtyByWork(string StartTime, string EndTime)
        {
            var list = VisuallargeScreenRepository1.GetQtyByWork(StartTime, EndTime);
            if (list != null)
            {
                return Ok(BaseResult.Result(list, "查询成功！", "200"));
            }
            return Ok(BaseResult.Result(false, "查询失败！", "500"));
        }


        /// <summary>
        /// 按装备大类统计
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [HttpGet("GetMaterialCategoryQty")]
        public IActionResult GetMaterialCategoryQty()
        {
            var list = VisuallargeScreenRepository1.GetMaterialCategoryQty();
            if (list != null)
            {
                return Ok(BaseResult.Result(list, "查询成功！", "200"));
            }
            return Ok(BaseResult.Result(false, "查询失败！", "500"));
        }

        /// <summary>
        /// 按器材分类统计
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [HttpGet("GetMaterialGroupsQty")]
        public IActionResult GetMaterialGroupsQty()
        {
            var list = VisuallargeScreenRepository1.GetMaterialGroupsQty();
            if (list != null)
            {
                return Ok(BaseResult.Result(list, "查询成功！", "200"));
            }
            return Ok(BaseResult.Result(false, "查询失败！", "500"));
        }

        /// <summary>
        /// 获取usb路径
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [HttpGet("GetUSBPath")]
        public IActionResult GetUSBPath()
        {
            var list = VisuallargeScreenRepository1.GetUSBPath();
            if (list != null)
            {
                return Ok(BaseResult.Result(list, "查询成功！", "200"));
            }
            return Ok(BaseResult.Result(false, "查询失败！", "500"));
        }

        /// <summary>
        /// 器材分类统计
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [HttpGet("GetMaterialTypeCount")]
        public IActionResult GetMaterialTypeCount()
        {
            var list = VisuallargeScreenRepository1.GetMaterialTypeCount();
            if (list != null)
            {
                return Ok(BaseResult.Result(list, "查询成功！", "200"));
            }
            return Ok(BaseResult.Result(false, "查询失败！", "500"));
        }

        /// <summary>
        /// 器材入库统计
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [HttpGet("GetEquipmentReceiving")]
        public IActionResult GetEquipmentReceiving()
        {
            var list = VisuallargeScreenRepository1.GetEquipmentReceiving();
            if (list != null)
            {
                return Ok(BaseResult.Result(list, "查询成功！", "200"));
            }
            return Ok(BaseResult.Result(false, "查询失败！", "500"));
        }

        /// <summary>
        /// 器材出库统计
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [HttpGet("GetEquipmentShipping")]
        public IActionResult GetEquipmentShipping()
        {
            var list = VisuallargeScreenRepository1.GetEquipmentShipping();
            if (list != null)
            {
                return Ok(BaseResult.Result(list, "查询成功！", "200"));
            }
            return Ok(BaseResult.Result(false, "查询失败！", "500"));
        }

    }




   
}
